#define MOD 1000000007

#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>

int table[100050][2] = {0};
int divisors[65];

int main(void) {
    table[4][0] = 0;
    table[4][1] = 2;
    table[9][0] = 1;
    table[9][1] = 2;
    table[16][0] = 0;
    table[16][1] = 4;
    table[25][0] = 2;
    table[25][1] = 2;
    table[49][0] = 3;
    table[49][1] = 2;
    table[81][0] = 1;
    table[81][1] = 4;
    table[121][0] = 4;
    table[121][1] = 2;
    table[169][0] = 5;
    table[169][1] = 2;
    table[289][0] = 6;
    table[289][1] = 2;
    table[361][0] = 7;
    table[361][1] = 2;
    table[529][0] = 8;
    table[529][1] = 2;
    table[625][0] = 2;
    table[625][1] = 4;
    table[841][0] = 9;
    table[841][1] = 2;
    table[961][0] = 10;
    table[961][1] = 2;
    table[1369][0] = 11;
    table[1369][1] = 2;
    table[1681][0] = 12;
    table[1681][1] = 2;
    table[1849][0] = 13;
    table[1849][1] = 2;
    table[2209][0] = 14;
    table[2209][1] = 2;
    table[2401][0] = 3;
    table[2401][1] = 4;
    table[2809][0] = 15;
    table[2809][1] = 2;
    table[3481][0] = 16;
    table[3481][1] = 2;
    table[3721][0] = 17;
    table[3721][1] = 2;
    table[4489][0] = 18;
    table[4489][1] = 2;
    table[5041][0] = 19;
    table[5041][1] = 2;
    table[5329][0] = 20;
    table[5329][1] = 2;
    table[6241][0] = 21;
    table[6241][1] = 2;
    table[6889][0] = 22;
    table[6889][1] = 2;
    table[7921][0] = 23;
    table[7921][1] = 2;
    table[9409][0] = 24;
    table[9409][1] = 2;
    table[10201][0] = 25;
    table[10201][1] = 2;
    table[10609][0] = 26;
    table[10609][1] = 2;
    table[11449][0] = 27;
    table[11449][1] = 2;
    table[11881][0] = 28;
    table[11881][1] = 2;
    table[12769][0] = 29;
    table[12769][1] = 2;
    table[14641][0] = 4;
    table[14641][1] = 4;
    table[16129][0] = 30;
    table[16129][1] = 2;
    table[17161][0] = 31;
    table[17161][1] = 2;
    table[18769][0] = 32;
    table[18769][1] = 2;
    table[19321][0] = 33;
    table[19321][1] = 2;
    table[22201][0] = 34;
    table[22201][1] = 2;
    table[22801][0] = 35;
    table[22801][1] = 2;
    table[24649][0] = 36;
    table[24649][1] = 2;
    table[26569][0] = 37;
    table[26569][1] = 2;
    table[27889][0] = 38;
    table[27889][1] = 2;
    table[28561][0] = 5;
    table[28561][1] = 4;
    table[29929][0] = 39;
    table[29929][1] = 2;
    table[32041][0] = 40;
    table[32041][1] = 2;
    table[32761][0] = 41;
    table[32761][1] = 2;
    table[36481][0] = 42;
    table[36481][1] = 2;
    table[37249][0] = 43;
    table[37249][1] = 2;
    table[38809][0] = 44;
    table[38809][1] = 2;
    table[39601][0] = 45;
    table[39601][1] = 2;
    table[44521][0] = 46;
    table[44521][1] = 2;
    table[49729][0] = 47;
    table[49729][1] = 2;
    table[51529][0] = 48;
    table[51529][1] = 2;
    table[52441][0] = 49;
    table[52441][1] = 2;
    table[54289][0] = 50;
    table[54289][1] = 2;
    table[57121][0] = 51;
    table[57121][1] = 2;
    table[58081][0] = 52;
    table[58081][1] = 2;
    table[63001][0] = 53;
    table[63001][1] = 2;
    table[66049][0] = 54;
    table[66049][1] = 2;
    table[69169][0] = 55;
    table[69169][1] = 2;
    table[72361][0] = 56;
    table[72361][1] = 2;
    table[73441][0] = 57;
    table[73441][1] = 2;
    table[76729][0] = 58;
    table[76729][1] = 2;
    table[78961][0] = 59;
    table[78961][1] = 2;
    table[80089][0] = 60;
    table[80089][1] = 2;
    table[83521][0] = 6;
    table[83521][1] = 4;
    table[85849][0] = 61;
    table[85849][1] = 2;
    table[94249][0] = 62;
    table[94249][1] = 2;
    table[96721][0] = 63;
    table[96721][1] = 2;
    table[97969][0] = 64;
    table[97969][1] = 2;

    divisors[0] = 2;
    divisors[1] = 3;
    divisors[2] = 5;
    divisors[3] = 7;
    divisors[4] = 11;
    divisors[5] = 13;
    divisors[6] = 17;
    divisors[7] = 19;
    divisors[8] = 23;
    divisors[9] = 29;
    divisors[10] = 31;
    divisors[11] = 37;
    divisors[12] = 41;
    divisors[13] = 43;
    divisors[14] = 47;
    divisors[15] = 53;
    divisors[16] = 59;
    divisors[17] = 61;
    divisors[18] = 67;
    divisors[19] = 71;
    divisors[20] = 73;
    divisors[21] = 79;
    divisors[22] = 83;
    divisors[23] = 89;
    divisors[24] = 97;
    divisors[25] = 101;
    divisors[26] = 103;
    divisors[27] = 107;
    divisors[28] = 109;
    divisors[29] = 113;
    divisors[30] = 127;
    divisors[31] = 131;
    divisors[32] = 137;
    divisors[33] = 139;
    divisors[34] = 149;
    divisors[35] = 151;
    divisors[36] = 157;
    divisors[37] = 163;
    divisors[38] = 167;
    divisors[39] = 173;
    divisors[40] = 179;
    divisors[41] = 181;
    divisors[42] = 191;
    divisors[43] = 193;
    divisors[44] = 197;
    divisors[45] = 199;
    divisors[46] = 211;
    divisors[47] = 223;
    divisors[48] = 227;
    divisors[49] = 229;
    divisors[50] = 233;
    divisors[51] = 239;
    divisors[52] = 241;
    divisors[53] = 251;
    divisors[54] = 257;
    divisors[55] = 263;
    divisors[56] = 269;
    divisors[57] = 271;
    divisors[58] = 277;
    divisors[59] = 281;
    divisors[60] = 283;
    divisors[61] = 293;
    divisors[62] = 307;
    divisors[63] = 311;
    divisors[64] = 313;

#define DIVISOR_COUNT 65

    int t;
    scanf("%d", &t);
    for(int i = 0; i < t; i++) {
        int n;
        scanf("%d", &n);
        int nums[DIVISOR_COUNT] = {0};
        for (int j = 0; j < n; j++) {
            int a;
            scanf("%d", &a);
            if (table[a][1] != 0) {
                nums[table[a][0]] += table[a][1];
            }
        }
        int64_t result = 1;
        for (int j = 0; j < DIVISOR_COUNT; j++) {
            result *= nums[j] + 1;
            result %= MOD;
        }
        printf("%" PRId64 "\n", result);
    }
    return 0;
}
